package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
public class Dailycost {
    private int dailycostId;
    private String dailycostType;
    private Integer dailycostNumber;
    private Integer dailycostTotal;
    private String dailycostPersonel;
    private Hospinfo hospinfoByHospinfoId;

    @Id
    @Column(name = "dailycost_id", nullable = false)
    public int getDailycostId() {
        return dailycostId;
    }

    public void setDailycostId(int dailycostId) {
        this.dailycostId = dailycostId;
    }

    @Basic
    @Column(name = "dailycost_type", nullable = true, length = 30)
    public String getDailycostType() {
        return dailycostType;
    }

    public void setDailycostType(String dailycostType) {
        this.dailycostType = dailycostType;
    }

    @Basic
    @Column(name = "dailycost_number", nullable = true)
    public Integer getDailycostNumber() {
        return dailycostNumber;
    }

    public void setDailycostNumber(Integer dailycostNumber) {
        this.dailycostNumber = dailycostNumber;
    }

    @Basic
    @Column(name = "dailycost_total", nullable = true, precision = 0)
    public Integer getDailycostTotal() {
        return dailycostTotal;
    }

    public void setDailycostTotal(Integer dailycostTotal) {
        this.dailycostTotal = dailycostTotal;
    }

    @Basic
    @Column(name = "dailycost_personel", nullable = true, length = 50)
    public String getDailycostPersonel() {
        return dailycostPersonel;
    }

    public void setDailycostPersonel(String dailycostPersonel) {
        this.dailycostPersonel = dailycostPersonel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dailycost dailycost = (Dailycost) o;
        return dailycostId == dailycost.dailycostId &&
                Objects.equals(dailycostType, dailycost.dailycostType) &&
                Objects.equals(dailycostNumber, dailycost.dailycostNumber) &&
                Objects.equals(dailycostTotal, dailycost.dailycostTotal) &&
                Objects.equals(dailycostPersonel, dailycost.dailycostPersonel);
    }

    @Override
    public int hashCode() {
        return Objects.hash(dailycostId, dailycostType, dailycostNumber, dailycostTotal, dailycostPersonel);
    }

    @ManyToOne
    @JoinColumn(name = "hospinfo_id", referencedColumnName = "hospinfo_id")
    public Hospinfo getHospinfoByHospinfoId() {
        return hospinfoByHospinfoId;
    }

    public void setHospinfoByHospinfoId(Hospinfo hospinfoByHospinfoId) {
        this.hospinfoByHospinfoId = hospinfoByHospinfoId;
    }
}
